package com.yu.crm.controller;

import com.yu.crm.domain.response.NumberVisitsRes;
import com.yu.crm.service.impl.PubUserActionLogService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/pub-statistics")
@Api(value = "统计",tags = {"统计"})
public class PubStatisticsController {

    @Autowired
    PubUserActionLogService pubUserActionLogService;

    /**
     * 行为统计
     */
    @GetMapping("behavior-statistics")
    @ApiOperation("行为统计")
    public List<Map<String,String>> behaviorStatistics() {
        return pubUserActionLogService.behaviorStatistics();
    }


    /**
     * 访问数量
     */
    @GetMapping("number-visits")
    @ApiOperation("访问数量")
    public List<Map<String,String>> numberVisits() {
        return pubUserActionLogService.numberVisits();
    }

    /**
     * 用户及ip总数
     */
    @GetMapping("user-count")
    @ApiOperation("用户访问量、访问ip总量、访问页面总量、平均访问量")
    public NumberVisitsRes userCount() {
        return pubUserActionLogService.userCount();
    }


    /**
     * 应用类统计
     */
    @GetMapping("app-count")
    @ApiOperation("应用类统计")
    public List<Map<String, Integer>> appCount() {
        return pubUserActionLogService.appCount();
    }
}
